package com.zx.callback.common.enums;

/**
 * @author ：yanst
 * @since: 2017/10/15
 * @history：(date editor desc)
 */
public enum ApiReqCodeEnum {
    /**
     * 一、基础模块(1001-2000)
     */
    //注册(1001-1100)
    REGIST(1001, "注册", 1),


    //登录(1101-1200)
    LOGIN(1101, "登录", 1),

    //客户管理
    UPDATE_FROM_TITLE(1201, "修改表单标题", 1),
    UPDATE_REV_EMAIL(1203, "修改接受邮箱", 1),

    //客户积分管理
    MODIFY_SCORE(1301, "修改积分", 1),

    //订单列表
    ORDER_LIST(1401, "订单列表", 1),
    ;

    public static boolean contains(Integer code) {
        if (code != null) {
            for (ApiReqCodeEnum e : ApiReqCodeEnum.values()) {
                if (e.getCode() == code.intValue()) {
                    return true;
                }
            }
        }
        return false;
    }

    private int code;

    private String desc;

    //日志类型
    private int logType;

    private boolean isRecordLog;

    ApiReqCodeEnum(int code, String desc, int logType) {
        this.code = code;
        this.desc = desc;
        this.logType = logType;
        this.isRecordLog = true;

    }


    ApiReqCodeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
        this.logType = code;
        this.isRecordLog = true;

    }

    ApiReqCodeEnum(int code, String desc, int logType, boolean isRecordLog) {
        this.code = code;
        this.desc = desc;
        this.logType = logType;
        this.isRecordLog = isRecordLog;

    }

    public boolean isRecordLog() {
        return isRecordLog;
    }

    public int getLogType() {
        return logType;
    }

    public String getDesc() {
        return desc;
    }

    public int getCode() {
        return code;
    }
}
